import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InDetailVO, InDetailForm, InDetailQuery } from '@/api/wmscloud/inDetail/types';

/**
 * 查询入库单详情列表
 * @param query
 * @returns {*}
 */

export const listInDetail = (query?: InDetailQuery): AxiosPromise<InDetailVO[]> => {
  return request({
    url: '/system/inDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询入库单详情详细
 * @param detailId
 */
export const getInDetail = (detailId: string | number): AxiosPromise<InDetailVO> => {
  return request({
    url: '/system/inDetail/' + detailId,
    method: 'get'
  });
};

/**
 * 新增入库单详情
 * @param data
 */
export const addInDetail = (data: InDetailForm) => {
  return request({
    url: '/system/inDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改入库单详情
 * @param data
 */
export const updateInDetail = (data: InDetailForm) => {
  return request({
    url: '/system/inDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除入库单详情
 * @param detailId
 */
export const delInDetail = (detailId: string | number | Array<string | number>) => {
  return request({
    url: '/system/inDetail/' + detailId,
    method: 'delete'
  });
};
